#!/usr/bin/env python

import sys
import pandas as pd
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt

tsv_path = sys.argv[1]

df = pd.read_csv(tsv_path, parse_dates=True)
df['timestamp'] = pd.to_datetime(df['timestamp'])
df = df.set_index('timestamp')

plt.figure(figsize=(20, 40))

groups = df.groupby('currency')
#fig, ax = plt.subplots(figsize=(100, 50))

i = 0
for name, group in groups:
  plt.subplot(7, 1, 1 + i)
  plt.title(name)
  if name == 'AdjustedQuote':
    plt.plot(group['reserved'], marker='.', label=name)
  else:
    plt.plot(group['passive'], marker='.', label=name)
    plt.plot(group['passive'] + group['aggressive'], marker='.', label=name)
  print(name)
  i += 1

plt.savefig('output.png')
